package com.ericsson.smart.reportObjects;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.sax.SAXSource;

import org.xml.sax.InputSource;

import com.report.meta.ReportType;

public class GenerateReportObjects {

	public void generateObjects() throws JAXBException {
		// File file=new File("E:\\smartmeteringworkspace/EricssonSmartApp/src/main/resources");
		JAXBContext context = JAXBContext.newInstance("com.report.meta");

		Unmarshaller jaxbUnMarshaller = context.createUnmarshaller();
		JAXBElement<ReportType> r = jaxbUnMarshaller.unmarshal(
				new SAXSource(new InputSource(GenerateReportObjects.class.getClassLoader()
						.getResourceAsStream("ConsumptionReport.xml"))), ReportType.class);
		ReportType r1 = r.getValue();
		System.out.println(r1.getReportDimentions().get(0).getDimentionID());
	}
}
